<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/page/share/taglib.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="pragma" content="no-cache">
<META http-equiv="Cache-Control" content="no-cache, must-revalidate">
<META http-equiv="expires" content="Wed, 26 Feb 2006 08:21:57 GMT">
<META http-equiv="Content-TYPE" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="/shop/css/global/top.css" media="all" type="text/css"/>
<link rel="stylesheet" href="/shop/css/shopping/pay.css" media="all" type="text/css"/>
<TITLE>结算中心：选择支付方式 52橙子网</TITLE>
<SCRIPT language=JavaScript src="/js/FoshanRen.js"></SCRIPT>
<link href="/shop/css/global/paymentway.css" rel="stylesheet" type="text/css">
<SCRIPT LANGUAGE="JavaScript">
<!--
// 表单验证
function validateForm(){
	var form = document.forms[0];
	if(""==getradiovalue(form.deliverway)){
		alert("\n请选择 '送货方式'");
		window.location="#deliverway";
		return false;
	}
	if(""==getradiovalue(form.paymentway)){
		alert("\n请选择 '支付方式'");
		window.location="#paymentway";
		return false;
	}
	return true;
}
function sendForm(){
	var form = document.forms[0];
	if(validateForm()) form.submit();
}
/*
 * 功能：取单选框的值
 */
function getradiovalue(obj){
	var result = "";
	try{		
		if (obj!=null){
			result = obj.value;
			if(typeof(result)=="undefined"){
				result="";
				for (i=0;i<obj.length;i++){
					if (obj[i].checked){
						result = obj[i].value;
						break;
					}
				}
			}
		}
	}catch(e){result="";}
	return result;
}

function paymentwaySelect(paymentwayValue){
	var paymentway_COD = document.getElementById('paymentway_COD');
	var timerequirement = document.getElementById('timerequirement');
	if(paymentway_COD!=null){
		if("GENERALPOST"==paymentwayValue || "EMS"==paymentwayValue){
			paymentway_COD.style.display="none";
			timerequirement.style.display="none";
			try{
				var form = document.forms[0];
				for (var i=0; i<form.paymentway.length; i++){
					if(form.paymentway[i].checked && "COD"==form.paymentway[i].value){
						if(i>0) form.paymentway[0].checked=true;
						form.paymentway[i].checked=false;						
						break;
					}
				}
			}catch(e){;}
		}else{
			paymentway_COD.style.display="block";
			timerequirement.style.display="block";
		}
	}
}

function showcashticket(){
	var cashticketlib = document.getElementById('cashticketlib');
	if(cashticketlib.style.display!="none"){
		cashticketlib.style.display="none";
	}else{
		cashticketlib.style.display="block";
	}
}

function selectcashticket(cardno, cardpwd){
	document.forms[0].cardno.value = cardno;
	document.forms[0].cardpassword.value = cardpwd;
	showcashticket();
	checkCashticket();//代金券验证
}

/** 根据值设置对象checked状态为true **/
	function setSelectRadioByValue(radioObject, value){
		if(typeof(radioObject.value)=="undefined"){
			for(var i=0;i<radioObject.length;i++){
				if(radioObject[i].value==value){
					radioObject[i].checked=true;
					break;
				}
			}
		}else{
			if(radioObject.value==value) radioObject.checked=true;
		}
	}

function pageinit(){	
	var form = document.forms[0];
	var deliverway = getradiovalue(form.deliverway);
	if(""!=deliverway){
		var timerequirement = document.getElementById('timerequirement');
		if("EXPRESSDELIVERY"==deliverway || "EXIGENCEEXPRESSDELIVERY"==deliverway){
			timerequirement.style.display="block";
		}
		var requirement = getradiovalue(form.requirement);
		if(""==requirement){
			if(form.delivernote.value.trim()!="") setSelectRadioByValue(form.requirement, "other");
		}else if("other"!=requirement){
			form.delivernote.value="";
		}
	}
}

//-->
</SCRIPT>
</HEAD>

<BODY onload="pageinit()">
<jsp:include page="/WEB-INF/page/share/Head.jsp"></jsp:include>
	
        <div class="type">
        	<img src="/shop/image/shopping/pay_type_icon.png"/>
        </div>
        <html:form action="/customer/shopping/manage" method="post">
	<INPUT TYPE="hidden" NAME="method" value="savePaymentway">
        <div class="box">
        	
            <div class="box_header">
            	<font>请选择您的送货与支付方式:</font>
            </div>
            
            <div class="box_body">
            	<div class="box_body_sendtype">送货方式:</div>
                <div class="box_body_sendcontent">
                	<html:radio property="deliverway" value="MAEKETDELIVERY" onclick="javascript:paymentwaySelect(this.value)"/>
                    <a>商场送货上门</a>
                    <font>(费用:0.0元)支持货到付款</font>
                    <br/>
                    <font>特殊说明:</font>
                    <html:text property="delivernote" maxlength="100" size="40" onfocus="javascript:setSelectRadioByValue(this.form.requirement,'other')" />
					<font color="green">你可以注明要求商家在半小时、1小时、2小时内送货上门</font>
                </div>               
                <div class="box_body_line"></div>
                <div class="box_body_sendtype">支付方式:</div>
                <div class="box_body_sendcontent">
                	<html:radio property="paymentway" value="COD" />
                    <a>货到付款</a>             
                </div>
                <div class="box_body_next"><IMG onClick="javascript:sendForm()"
					height="22" src="/shop/image/shopping/next_btn.png"
					vspace=5 border=0 style="CURSOR: hand;"></div>
            </div>
        
        </div>
</html:form>
</BODY>
<jsp:include page="/WEB-INF/page/share/Foot.jsp"></jsp:include>
</HTML>